package deviceservice.token;

import deviceservice.utils.CryptoUtil;

/**
 * Created by Jason on 2017/8/22.
 */
public class AuthToken {
    public static String getAddreqToken(long timestamp, String username, String key, String url){
        return dobetter(timestamp,username,key,url);

    }
    public static String getAddresToken(int result, long timestampJ, long timestampD, String username, String key){
        return dobetter(result,timestampJ,timestampD,username,key);
    }
    public static String getAccessToken(long timestampJ, long timestampD,String username, String key){
       return dobetter(timestampJ,timestampD,username,key);
    }
    public static String getdevID(long timestamp,String sysAdd){

        return dobetter(timestamp,sysAdd);

    }
    public static String getDevReqToken(long timestamp,String access_token,String dev_id,int heart,String logIP){
        return dobetter(timestamp,access_token,dev_id,heart,logIP);
    }
    public static String getLoginToken(String accessToken,long timestamp,String devID){
        return dobetter(accessToken,timestamp,devID);
    }
    public static String getQueryToken(String accessToken,long timestamp,String query,String devID){
        return dobetter(accessToken,timestamp,query,devID);

    }
    public static String getFillToken(String accessToken,long timestamp,String command,String devID){
        return dobetter(accessToken,timestamp,command,devID);
    }
    public static String getResultToken(String accessToken, long timestamp, String devID, int result){
        return dobetter(accessToken,timestamp,devID,result);
    }
    public static String getQueryResultToken(String accessToken, long timestamp, String devID, String hashdata,int result){
        return dobetter(accessToken,timestamp,devID,hashdata,result);
    }
    public static String dobetter(Object ...args){
        StringBuilder stringBuilder = new StringBuilder();
        for(Object o :args)
            stringBuilder.append(o);
        return CryptoUtil.hash(stringBuilder.toString());

    }

}
